﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreShop.Model.OrderModels
{
    public class OnlineOrderModel
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        public long id { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        public string orderSn { get; set; }

        /// <summary>
        /// 支付总金额 合计=商品金额-优惠总金额
        /// </summary>
        public decimal? payAmount { get; set; }
        /// <summary>
        /// 订单总金额=商品总金额
        /// </summary>
        public decimal? totalAmount { get; set; }
        /// <summary>
        /// 用户名称
        /// </summary>
        public string userName { get; set; }

        /// <summary>
        /// 用户手机号
        /// </summary>
        public string userPhone { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime payTime { get; set; }
        /// <summary>
        /// 序号
        /// </summary>
        public int LineNo { get; set; }

        /// <summary>
        /// 活动Id
        /// </summary>
        public string ActivityId { get; set; }

        /// <summary>
        /// 活动名称
        /// </summary>
        public string ActivityName { get; set; }

        /// <summary>
        /// 活动图片
        /// </summary>
        public string ActivityPicture { get; set; }


        /// <summary>
        /// 门店id
        /// </summary>
        public string BranchId { get; set; }

        /// <summary>
        /// 关闭时间
        /// </summary>
        public string CloseTime { get; set; }

        /// <summary>
        /// 消息状态码
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 优惠卷金额
        /// </summary>
        public decimal? DiscountAmount { get; set; }

        /// <summary>
        /// 普通订单配送类型 1 自提 2 配送
        /// </summary>
        public string DispatchingType { get; set; }

        /// <summary>
        /// 优惠总金额 优惠券
        /// </summary>
        public decimal? FreeAmount { get; set; }

        /// <summary>
        /// 商品总金额 售价
        /// </summary>
        public decimal? ItemAmount { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string ItemContent { get; set; }

        /// <summary>
        /// 商品数量
        /// </summary>
        public decimal? ItemNumber { get; set; }

        /// <summary>
        /// 消息内容
        /// </summary>
        public string Msg { get; set; }

        /// <summary>
        /// 1普通订单 2秒杀订单 3 接龙  4 预售 5拼团
        /// </summary>
        public string OrderType { get; set; }

        public string OrderTypeName 
        {
            get
            {
                string Name = "";
                if (OrderType == "1")
                {
                    Name = "普通订单";
                }
                else if (OrderType == "2") 
                {
                    Name = "秒杀订单";
                }
                else if (OrderType == "3")
                {
                    Name = "接龙";
                }
                else if (OrderType == "4")
                {
                    Name = "预售";
                }
                else if (OrderType == "5")
                {
                    Name = "拼团";
                }
                return Name;
            }
        }

        /// <summary>
        /// 支付订单号 流水号
        /// </summary>
        public string PaySn { get; set; }

        /// <summary>
        /// 1余额 0微信
        /// </summary>
        public string PayType { get; set; }

        public string Refund { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }


        /// <summary>
        /// 订单来源 1小程序  2 直播 3支付宝小程序
        /// </summary>
        public string SourceType { get; set; }

        /// <summary>
        /// 状态 1未支付  3 待提货 4 退款中 -2 超时关闭 8 交易完成  -1 交易关闭 2备货中
        /// </summary>
        public int Status { get; set; }

        public string StatusName
        {
            get
            {
                string strSataus = "";
                switch (Status)
                {
                    case 1:
                        strSataus = "未支付";
                        break;
                    case 3:
                        strSataus = DispatchingType == "1" ? "待提货" : "待配送";
                        break;
                    case 4:
                        strSataus = "退款中";
                        break;
                    case 5:
                        strSataus = DispatchingType == "1" ? "已提货" : "已配送";
                        break;
                    case -2:
                        strSataus = "超时关闭";
                        break;
                    case 8:
                        strSataus = "交易完成";
                        break;
                    case -1:
                        strSataus = "交易关闭";
                        break;
                    case 2:
                        strSataus = "备货中";
                        break;
                }
                return strSataus;
            }
        }

        /// <summary>
        /// 门店名称
        /// </summary>
        public string StoreName { get; set; }

        /// <summary>
        /// 交易完成状态 1 未完成 2 已完成 已提货
        /// </summary>
        public string SuccessStatus { get; set; }

        /// <summary>
        /// 总记录数
        /// </summary>
        public string Total { get; set; }

        /// <summary>
        /// 用户id
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 支付方式ID
        /// </summary>
        public string balanceTypeId { get; set; }

        public string deliveryChannel { get; set; }

        public string deliveryChannelName 
        { 
            get 
            {
                string NameType = "";
                if (deliveryChannel == "93623")
                {
                    NameType = "达达配送";
                }
                else if (deliveryChannel == "93619") 
                {
                    NameType = "美团配送";
                }
                else if (deliveryChannel == "93617")
                {
                    NameType = "商家配送";
                }
                return NameType;
            }
        }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "createTime", IsNullable = true)]
        public DateTime? createTime { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(ColumnName = "updateTime", IsNullable = true)]
        public DateTime? updateTime { get; set; }

        public BaseBranchInfo BaseBranchInfo { get; set; }

        public BaseBranchInfoExt BaseBranchInfoExt { get; set; }
        public List<XcxOrderItem> XcxOrderItem { get; set; }
        
        public XcxOrderLine XcxOrderLine { get; set; }
    }

    /// <summary>
    /// BaseBranchInfo
    /// </summary>
    public partial class BaseBranchInfo
    {
        /// <summary>
        /// 门店地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 区县
        /// </summary>
        public string Area { get; set; }

        /// <summary>
        /// 营销区域
        /// </summary>
        public string AreaId { get; set; }

        /// <summary>
        /// 门店id
        /// </summary>
        public string BranchId { get; set; }

        /// <summary>
        /// 门店名称
        /// </summary>
        public string BranchName { get; set; }

        /// <summary>
        /// 门店编码
        /// </summary>
        public string BranchNo { get; set; }

        /// <summary>
        /// 门店类型0直营店1加盟店2联营店
        /// </summary>
        public string BranchType { get; set; }

        /// <summary>
        /// 是否线下业务 0 是 1 否
        /// </summary>
        public string CanOffLine { get; set; }

        /// <summary>
        /// 是否线上业务 0 是 1 否
        /// </summary>
        public string CanOnLine { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 企业性质 0 一般纳税人 1 小规模纳税人
        /// </summary>
        public string CompanyType { get; set; }

        /// <summary>
        /// 国家
        /// </summary>
        public string Country { get; set; }

        /// <summary>
        /// 经度
        /// </summary>
        public string Latitude { get; set; }

        /// <summary>
        /// 纬度
        /// </summary>
        public string Longitude { get; set; }

        /// <summary>
        /// 组织
        /// </summary>
        public string OrganizationId { get; set; }

        /// <summary>
        /// 邮政编码
        /// </summary>
        public string PostCode { get; set; }

        /// <summary>
        /// 省份
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 状态0未开业1营业2闭店
        /// </summary>
        public string Status { get; set; }
    }

    /// <summary>
    /// BaseBranchInfoExt
    /// </summary>
    public partial class BaseBranchInfoExt
    {
        /// <summary>
        /// 起购金额
        /// </summary>
        public decimal? BeginAmount { get; set; }

        /// <summary>
        /// 门店ID
        /// </summary>
        public string BranchId { get; set; }

        /// <summary>
        /// 营业日期
        /// </summary>
        public string BusinessDay { get; set; }

        /// <summary>
        /// 创建者
        /// </summary>
        public string CreateBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public string CreateTime { get; set; }

        /// <summary>
        /// 抖音门店id
        /// </summary>
        public string DyBranchId { get; set; }

        /// <summary>
        /// 营业结束时间
        /// </summary>
        public string EndTime { get; set; }

        /// <summary>
        /// id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 快手门店id
        /// </summary>
        public string KsBranchId { get; set; }

        /// <summary>
        /// 基础包装费
        /// </summary>
        public decimal? PackageAmount { get; set; }

        /// <summary>
        /// 付款成功后多少分钟呼叫配送
        /// </summary>
        public string PayMinute { get; set; }

        /// <summary>
        /// 预订单到期前多少分钟呼叫配送
        /// </summary>
        public string PreMinute { get; set; }

        /// <summary>
        /// 优先配送公司 1美团 0蜂鸟
        /// </summary>
        public string PriorityDelivery { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 店长微信图片
        /// </summary>
        public string ShopManager { get; set; }

        /// <summary>
        /// 营业开业时间
        /// </summary>
        public string StartTime { get; set; }

        /// <summary>
        /// 线上门店状态0开启1关闭
        /// </summary>
        public string Status { get; set; }

        /// <summary>
        /// 更新者
        /// </summary>
        public string UpdateBy { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public string UpdateTime { get; set; }

        /// <summary>
        /// 群二维码
        /// </summary>
        public string WxCode { get; set; }

        /// <summary>
        /// 小时达门店id
        /// </summary>
        public string XsdBranchId { get; set; }

        /// <summary>
        /// 营业状态0营业1打烊
        /// </summary>
        public string YyStatus { get; set; }

        /// <summary>
        /// 支付宝门店id
        /// </summary>
        public string ZfbBranchId { get; set; }
    }

    /// <summary>
    /// 小程序订单商品关联
    ///
    /// XcxOrderItem
    /// </summary>
    public partial class XcxOrderItem
    {
        /// <summary>
        /// 序号
        /// </summary>
        public string lineNo { get; set; }

        /// <summary>
        /// 佣金
        /// </summary>
        public decimal? commissionAmount { get; set; }

        /// <summary>
        /// 佣金比例
        /// </summary>
        public decimal? commissionRatio { get; set; }

        /// <summary>
        /// 优惠券分摊金额
        /// </summary>
        public decimal? couponShareAmount { get; set; }

        /// <summary>
        /// 优惠券总金额
        /// </summary>
        public decimal? discountAmount { get; set; }

        /// <summary>
        /// 副标题
        /// </summary>
        public string goodsSubhead { get; set; }

        public string id { get; set; }

        /// <summary>
        /// 商品id
        /// </summary>
        public string itemId { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string itemName { get; set; }

        /// <summary>
        /// 选择的内容
        /// </summary>
        public string multipleSkuContent { get; set; }

        /// <summary>
        /// 购买数量
        /// </summary>
        public string num { get; set; }

        /// <summary>
        /// 订单id
        /// </summary>
        public string OrderHeadId { get; set; }

        /// <summary>
        /// 订单商品类型：1赠品
        /// </summary>

        public string orderItemType { get; set; }

        /// <summary>
        /// 拣货数量
        /// </summary>
        public decimal? pickingNumber { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        public string PicUrl { get; set; }

        /// <summary>
        /// 售价
        /// </summary>
        public decimal? price { get; set; }

        /// <summary>
        /// 真实退款金额
        /// </summary>
        public decimal? realRefundAmount { get; set; }

        /// <summary>
        /// 实际退款金额
        /// </summary>
        public decimal? refundAmount { get; set; }

        /// <summary>
        /// 退款ID
        /// </summary>
        public string refundId { get; set; }

        /// <summary>
        /// 退款数量
        /// </summary>
        public string refundNum { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string remark { get; set; }

        /// <summary>
        /// 评论状态 0未评论 1已评论
        /// </summary>
        public string reviewStatus { get; set; }

        /// <summary>
        /// 销售价
        /// </summary>
        public decimal? salePrice { get; set; }

        /// <summary>
        /// 秒杀
        /// </summary>
        public string SeckillId { get; set; }

        /// <summary>
        /// 商品服务费
        /// </summary>
        public decimal? ServeAmount { get; set; }

        /// <summary>
        /// 服务名称
        /// </summary>
        public string ServeName { get; set; }

        /// <summary>
        /// 分摊金额
        /// </summary>
        public decimal? ShareAmount { get; set; }

        /// <summary>
        /// skuid
        /// </summary>
        public string SkuId { get; set; }

        /// <summary>
        /// 商品原价
        /// </summary>
        public decimal? SourcePrice { get; set; }

        /// <summary>
        /// 商品规格信息 json
        /// </summary>
        public string Specifications { get; set; }

        /// <summary>
        /// 1 正常 2 已退款 3 拒绝 4成功 5申请中
        /// </summary>
        public string Status { get; set; }

        /// <summary>
        /// 拣货单位
        /// </summary>
        public string unit { get; set; }
        public string spuId { get; set; }
        public string spuCode { get; set; }
        public string spuName { get; set; }
        public string specId { get; set; }

    }

    /// <summary>
    /// XcxOrderLine
    /// </summary>
    public partial class XcxOrderLine
    {
        /// <summary>
        /// 预约提货时间
        /// </summary>
        public string AppointmentPickGoodsTime { get; set; }

        /// <summary>
        /// 消费本金
        /// </summary>
        public decimal? BasicAmount { get; set; }

        /// <summary>
        /// 当日门店流水号用于骑手取货
        /// </summary>
        public string DaySeq { get; set; }

        /// <summary>
        /// 配送失败原因
        /// </summary>
        public string DeliveryCloseReason { get; set; }

        /// <summary>
        /// 配送公司 0蜂鸟 1美团 2达达 3自配送
        /// </summary>
        public string DeliveryCompany { get; set; }

        /// <summary>
        /// 配送活动标识
        /// </summary>
        public string DeliveryId { get; set; }

        /// <summary>
        /// 1创建订单可取消 2未配送 可退款 3 已配送 4自配送已接单
        /// </summary>
        public string DeliveryStatus { get; set; }

        /// <summary>
        /// 消费赠金
        /// </summary>
        public decimal? DonateAmount { get; set; }

        /// <summary>
        /// 配送费
        /// </summary>
        public decimal? DriverAmount { get; set; }

        /// <summary>
        /// 期望送达结束时间
        /// </summary>
        public string ExpectEndTime { get; set; }

        /// <summary>
        /// 期望送达开始时间
        /// </summary>
        public string ExpectStartTime { get; set; }

        /// <summary>
        /// 配送优惠
        /// </summary>
        public decimal? FreeDriverAmount { get; set; }

        public string GroupId { get; set; }

        public string Id { get; set; }

        /// <summary>
        /// 订阅消息
        /// </summary>
        public string MsgJson { get; set; }

        /// <summary>
        /// 消息发送状态 1已发送  其他 未发送
        /// </summary>
        public string MsgStatus { get; set; }

        /// <summary>
        /// 美团内部配送ID
        /// </summary>
        public string MtPeisongId { get; set; }

        /// <summary>
        /// 提货结束时间
        /// </summary>
        public string PickEndTime { get; set; }

        /// <summary>
        /// 提货门店
        /// </summary>
        public string PickGoodsStoreId { get; set; }

        /// <summary>
        /// 提货门店
        /// </summary>
        public string PickGoodsStoreName { get; set; }

        /// <summary>
        /// 提货时间
        /// </summary>
        public string PickGoodsTime { get; set; }

        /// <summary>
        /// 提货开始时间
        /// </summary>
        public string PickStartTime { get; set; }

        /// <summary>
        /// 退款订单号
        /// </summary>
        public string RefundSn { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 销售价
        /// </summary>
        public decimal? SalePriceTotal { get; set; }

        /// <summary>
        /// 秒杀ID 接龙id 拼团id
        /// </summary>
        public string SeckillId { get; set; }

        /// <summary>
        /// 秒杀/拼团名称
        /// </summary>
        public string SeckillName { get; set; }

        /// <summary>
        /// 商品服务费总金额
        /// </summary>
        public decimal? ServeAmount { get; set; }

        /// <summary>
        /// 好享会员优惠金额
        /// </summary>
        public decimal? VipDiscountAmount { get; set; }

        public string XcxHeadId { get; set; }

        public string consigneeAddress { get; set; }
        public string consigneeName { get; set; }
        public string consigneePhone { get; set; }
    }
}

